// Tree Picker
// ----------------------

// tree picker name space
@tpns: ~"@{ns}@{tree-picker-prefix}";

.@{tpns}-view {
  background-color: @picker-tree-bg;
  max-height: 360px;
  overflow-y: auto;
}

.@{tpns}-view-node {
  position: relative;
  font-size: @picker-tree-node-font-size;
  line-height: @picker-tree-node-line-height;

  &-active > .@{tpns}-view-node-label {
    color: @picker-tree-node-active-color;
    background-color: @picker-tree-node-active-bg;
  }

  > .@{tpns}-view-node-label {
    margin: 0;
    padding: @picker-tree-node-padding-vertical @picker-tree-node-padding-horizontal;
    //text gap
    padding-left: @picker-tree-arrow-down-width+@picker-tree-arrow-down-gap+8px;
    display: inline-block;
    cursor: pointer;
    transition-timing-function: linear;
    transition-duration: .3s;
    transition-property: background-color, color;

    &::before {
      content: "";
      position: absolute;
      width: @picker-tree-arrow-down-width+@picker-tree-arrow-down-gap;
      height: 100%;
      background-color: @picker-tree-bg;
      top: 0;
      margin-left: -24px;
    }

    &:hover {
      background-color: @picker-tree-node-hover-bg;
    }
  }

  &-disabled {
    color: @picker-menu-item-disabled-color;
    cursor: @cursor-disabled;

    > .@{tpns}-view-node-label {
      cursor: @cursor-disabled;

      &,
      &:hover {
        background: transparent;
      }
    }
  }

  &:not(&-disabled):focus > .@{tpns}-view-node-label {
    background-color: @picker-tree-node-hover-bg;
  }
}

// expand icon
.@{tpns}-view-node-expand-icon-wrapper {
  display: inline-block;
  position: absolute;
  cursor: pointer;
  z-index: 1;

  > .@{tpns}-view-node-expand-icon {
    display: inline-block;
    padding: @picker-tree-node-padding-vertical 0;
    padding-right: @picker-tree-arrow-down-gap;
    height: 36px;
    font-size: @picker-tree-node-font-size;
    line-height: @picker-tree-node-line-height;
    transform: rotate(-90deg);
    transform-origin: 3.5px 16px;
    margin-left: -2px;
    margin-top: 2px;
    font-family: @font-family-icon;
    font-style: normal;

    &::before {
      content: @picker-tree-arrow-down;
    }

    // expand children tree
    .@{tpns}-view-open > .@{tpns}-view-node & {
      transform: rotate(0deg);
      margin-left: 0;
      margin-top: 0;
    }
  }
}

// node children
.@{tpns}-view-node-children {
  > .@{tpns}-view-children {
    display: none;

    // @todo animation
    .@{tpns}-view-open& {
      display: block;
    }
  }
}

.@{ns}picker-menu {
  &.@{tpns}-menu {
    padding-top: @picker-menu-padding;

    .@{ns}picker-search-bar {
      padding-top: 0;
    }
  }

  .@{tpns}-view {
    padding: 0 @picker-menu-padding @picker-menu-padding 0;

    &-node > .@{tpns}-view-node-label {
      .ellipsis;

      display: block;
    }
  }
}
